#ifndef CREATEMAP_H
#define CREATEMAP_H

#include <QWidget>
#include <QKeyEvent>
#include <QPaintEvent>
#include <QMouseEvent>
#include <QPainter>
#include <QPen>


#include <vector>
#include <iostream>
using namespace std;

typedef struct{
    int sx,sy;
    int width;
}Block;

namespace Ui {
class CreateMap;
}

class CreateMap : public QWidget
{
    Q_OBJECT

public:
    explicit CreateMap(QWidget *parent = 0);
    ~CreateMap();

    void keyPressEvent(QKeyEvent *ev);
    void paintEvent(QPaintEvent *);
    void mousePressEvent(QMouseEvent *event);
    void mouseMoveEvent(QMouseEvent *event);
    void mouseReleaseEvent(QMouseEvent *event);

    void addPoints(int x, int y);
    void backPoints();

    void saveMapBack();

    void init();

private slots:
    void on_pushButton_2_clicked();

    void on_pushButton_clicked();

private:
    Ui::CreateMap *ui;
    int width;
    int nx,ny;
    int lastx,lasty;
    bool global_width;
    int endx,endy;
    int lastNum;
    vector<Block> path;
};

#endif // CREATEMAP_H
